package com.kongwg.exer;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

/**
 * @author kongwg
 * @create 2020-12-15 20:48
 */
public class ExerTest {

    public static void main(String[] args) {
        int i=0;
        ArrayList list = new ArrayList();
        while (i<10){
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入数字");
            int i1 = scanner.nextInt();
            list.add(i1);

            i++;

        }
        Collections.sort(list, new Comparator() {
            @Override
            public int compare(Object o1, Object o2) {
                if (o1 instanceof Integer && o2 instanceof Integer){
                    Integer e1 = (Integer) o1;
                    Integer e2 = (Integer) o2;

                    return -e1.compareTo(e2);
                }
                throw new RuntimeException("输入的类型不一致");

            }
        });
        System.out.println(list);
    }
}
